package com.ycg.blog.mapper;

import com.ycg.blog.pojo.Category;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ycg.blog.pojo.vo.SimpleArticleVo;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
* @author lenovo
* @description 针对表【blog_category(分类信息)】的数据库操作Mapper
* @createDate 2024-03-02 12:05:04
* @Entity com.ycg.blog.pojo.Category
*/
public interface CategoryMapper extends BaseMapper<Category> {

    /**
     * 根据分类id获取该分类对应的文章数量
     * @param categoryIds
     * @return
     */
    @MapKey("name")
    Map<String, Map<String,Long>> getArticleIds(@Param("ids") List<Integer> categoryIds);

    /**
     * 根据分类id获取文章id, 标题和字数
     * @param categoryId
     * @return
     */
    List<SimpleArticleVo> getSimpleArticlesByCategoryId(@Param("categoryId") Integer categoryId);
}




